﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Omu.AwesomeMvc;
using MvcApplication4.Models;


namespace MvcApplication4.Controllers
{
    public class NomeAutocompleteController : Controller
    {

        private readonly BD_Vacinas2Context _db = new BD_Vacinas2Context();

        public ActionResult GetItems(string v)
        {
            v = (v ?? "").ToLower().Trim();

            TempData["tempnomedep"] = _db.tb_Paciente.Where(o => o.Nome_Paciente.ToLower().Contains(v)).ToList()
                .Select(o => new KeyContent(o.ID_Paciente, o.Nome_Paciente, false));

            return Json(_db.tb_Paciente.Where(o => o.Nome_Paciente.ToLower().Contains(v)).ToList()
                .Select(o => new KeyContent(o.ID_Paciente, o.Nome_Paciente, false)));
        }

    }
}
